// 影院排片数据库添加
const mongoose = require('mongoose');
let Mock = require('mockjs');
const { data } = require('jquery');
// const { schedules } = require("./data/schedules.js")
//  排片集合（schedules）
const testM = new mongoose.Schema(// 排片集合（schedules）
    {
        test: Object
    });
let a = {
    1: [1, 2, 3, 4, 5],
    2: [1, 2, 3, 4, 5],
    3: [1, 2, 3, 4, 5],
    4: [1, 2, 3, 4, 5],
    5: [1, 2, 3, 4, 5],
}
let b = {
    1: [1, 2, 3, 4],
    2: [1, 2, 3, 4],
    3: [1, 2, 3, 4],
    4: [1, 2, 3, 4],
}
[{i:1,j:1},{i:1,j:2}]

let seat=[];
for(let i=1;i<10;i++){
    let arr=[];
    for (let j = 1; j < 10; j++) {
        arr.push(j)
    }
    seat.push(arr)
}
console.log(seat);
const { test } = Mock.mock({
    "test|5": [{
        "test|1": [a, b],

    }]
})
let schedulesModle = mongoose.model("test", testM, "test");
// 建立链接
mongoose.connect("mongodb://tangzhenhua:Lovo123456@182.92.214.223:8084/heshumiao",
    {
        useNewUrlParser: true,
        useUnifiedTopology: true,
        auth: { authSource: "admin" }
    },
    async () => {
        await schedulesModle.create(seat);
        console.log(a);
    });